package ad.android.util;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;


/**
 * 概率计算
 * @author SunQuanQuan
 *
 */
public class ProbabilityUtil {
	private final static float splitPoint = 0.2F;
	
	public static int getIntWeight(float floatWeight){
		if(floatWeight <= splitPoint ){
			return (int)Math.floor(floatWeight);
		}
		else{
			return (int)Math.ceil(floatWeight);
		}
	}

	/**
	 * 0到1的随机float
	 * @return
	 */
	public static float getRandomFloatWeight() {
		return (float)Math.random();
	}

	/**
	 * 返回intWeightAdNum内的随机整形
	 * @param intWeightAdNum
	 * @return
	 */
	public static int getRandomInt(int intWeightAdNum) {
		return (int)(Math.random()*intWeightAdNum);
	}
	
	/*public static void main(String[] args) {
		System.out.println( ProbabilityUtil.getIntWeight(0.3f));
	}*/
	
}
